import $V from './$V';

export default function psy(price, length) {
    let PSYValue = $V.init(price.length,0);
    PSYValue = $V.set_by_index(PSYValue,$V.range(length),50);
    for(let i = length;i < price.length;i++){
        PSYValue[i] = $V.sum($V.compare($V.subv(price,i-length,i),$V.subv(price,i-length-1,i-1),">"))/length*100;
    }
    return PSYValue;
}
